new Vue({
  el: "#app",
  data() {
    return {
      UserInfo: {},
    };
  },
  mounted() {},
  methods: {
    getPersonInfo(Primary_Key) {
      let _this = this;
      $.ajax({
        headers: requestHeaders(),
        type: "POST",
        // url: `${BASE_URL2}/generalBusiness/generalPaginationQueryBySQLSerialNumber`,
        url: "https://service.kdddy.cn/donghui/generalBusiness/generalQueryByTableNameWithOriginal",
        data: {
          Data: "enterprise_info", //表名
          Condition: "Row_Status='0'",
        },
        success: function (Result) {
          console.log(Result);
          that.tableData = Result;
          //   that.total = Result.TotalRows;
        },
        complete: function (XMLHttpRequest) {
          //   requestPretreatment(XMLHttpRequest);
        },
        dataType: "json",
      });
      $.ajax({
        type: "POST",
        url: `${DomainName}/GoodsInquiryKeyOriginal`,
        data: {
          Primary_Key_Name: "User_Number", //主键名
          Primary_Key, //主键值
          Data: "system_user_info",
        },
        complete: function (XMLHttpRequest) {
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href =
              absolutepath + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        success: function (Result) {
          console.log(Result);
          _this.UserInfo = Result[0];
          _this.User_Number = Result[0].User_Number;
          _this.getPerson();
        },
        dataType: "json",
      });
    },
    getPerson() {
      $.ajax({
        type: "GET",
        url: `${BASE_URL}/weixin/generateQRCode?Phone=${$.cookie("use")}`,
        complete: function (XMLHttpRequest) {
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href =
              absolutepath + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        success: function (res) {
          console.log(res);
          let picwidth = 200;
          let picheight = 200;
          let qrcodeDivId = "qrcode";
          $("<div>").attr("id", qrcodeDivId).appendTo("body");
          $(`#${qrcodeDivId}`).qrcode({
            // render: table,
            width: picwidth, //宽度
            height: picheight, //高度
            text: res.data, //内容
            typeNumber: -1, //计算模
            correctLevel: 2, //二维码纠错级别
            background: "#ffffff", //背景额色
            foreground: "#898888", //二维码额色
          });
        },
        dataType: "json",
      });
    },
  },
});
